#ifndef __TERRAINBLOCKHEIGHTRAISOPERATOR_H__
#define __TERRAINBLOCKHEIGHTRAISOPERATOR_H__

#include <stl/list.h>
#include <stl/map.h>
#include <standard/delegate.h>
#include "operator/operator.h"


class CTerrainHeightOperator: public IDelegateInterface, public COperator{
public:
    CTerrainHeightOperator( CEditorSceneMgr* pSceneMgr );
    virtual ~CTerrainHeightOperator();
    virtual bool32 Init();
    virtual bool32 Final();
    virtual bool32 OnLMouseDown( int32 x, int32 y );
    virtual bool32 OnMouseMove( int32 x, int32 y );
    virtual bool32 OnLMouseUp( int32 x, int32 y );
    virtual void _Work( int32 nCellX, int32 nCellY, int32 nBrushSize ){}

protected:
    void OnNotification_SetTerrainBrushType(int32 w, int32 l, void* pUserData);
    void _AddTerrainCellHeightInfo( int32 x, int32 y, float fValue );
    void _FinishedWork();
    Ref< class CTerrainActiveBlockHelperObject* > m_rTerrainActiveBlockHelperObject;
    bool32 m_bIsButtonDown;
    int32 m_nButtonDownX;
    int32 m_nButtonDownY;
    int32 m_nButtonWorkX;
    int32 m_nButtonWorkY;

    map<uint32, float> m_vTerrainCellHeightInfoList;
};

class CTerrainHeightRiseOperator : public CTerrainHeightOperator {
public:
    CTerrainHeightRiseOperator( CEditorSceneMgr* pSceneMgr );
    virtual ~CTerrainHeightRiseOperator();
    virtual void _Work( int32 nCellX, int32 nCellY, int32 nBrushSize );

private:
    float _RiseCurve( float x );
};

class CTerrainHeightFallOperator : public CTerrainHeightOperator {
public:
    CTerrainHeightFallOperator( CEditorSceneMgr* pSceneMgr );
    virtual ~CTerrainHeightFallOperator();
    virtual void _Work( int32 nCellX, int32 nCellY, int32 nBrushSize );

private:
    float _FallCurve( float x );
};

class CTerrainHeightFlatOperator : public CTerrainHeightOperator {
public:
    CTerrainHeightFlatOperator( CEditorSceneMgr* pSceneMgr );
    virtual ~CTerrainHeightFlatOperator();
    virtual void _Work( int32 nCellX, int32 nCellY, int32 nBrushSize );
};

class CTerrainHeightSteepOperator : public CTerrainHeightOperator {
public:
    CTerrainHeightSteepOperator( CEditorSceneMgr* pSceneMgr );
    virtual ~CTerrainHeightSteepOperator();
    virtual void _Work( int32 nCellX, int32 nCellY, int32 nBrushSize );
    float _SteepCurve( float x, float y );
};

class CTerrainHeightSmoothOperator : public CTerrainHeightOperator {
public:
    CTerrainHeightSmoothOperator( CEditorSceneMgr* pSceneMgr );
    virtual ~CTerrainHeightSmoothOperator();
    virtual void _Work( int32 nCellX, int32 nCellY, int32 nBrushSize );
};
#endif
